package itheima.com.Day13.Test4;

public class Ticket implements Runnable {
    private int ticket =100;
    private final Object lock = new Object();
    @Override
    public void run() {
        while (true){
//            synchronized (lock){
                if(ticket<=0){
                    break;
                }else{
                    ticket--;
                    System.out.println(Thread.currentThread().getName()+"还剩"+ticket+"张票在出售");
                }
            }

    }
}
